<!doctype html>

<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>equationeditorbubble.js (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>


  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>

<div class="clear"></div>

<h2><a href="local_closure_goog_editor_plugins_equationeditorbubble.js.html">equationeditorbubble.js</a></h2>

<pre class="prettyprint lang-js">
<a name="line1"></a>// Copyright 2009 The Closure Library Authors. All Rights Reserved.
<a name="line2"></a>//
<a name="line3"></a>// Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
<a name="line4"></a>// you may not use this file except in compliance with the License.
<a name="line5"></a>// You may obtain a copy of the License at
<a name="line6"></a>//
<a name="line7"></a>//      http://www.apache.org/licenses/LICENSE-2.0
<a name="line8"></a>//
<a name="line9"></a>// Unless required by applicable law or agreed to in writing, software
<a name="line10"></a>// distributed under the License is distributed on an &quot;AS-IS&quot; BASIS,
<a name="line11"></a>// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<a name="line12"></a>// See the License for the specific language governing permissions and
<a name="line13"></a>// limitations under the License.
<a name="line14"></a>
<a name="line15"></a>goog.provide(&#39;goog.editor.plugins.equation.EquationBubble&#39;);
<a name="line16"></a>
<a name="line17"></a>goog.require(&#39;goog.dom&#39;);
<a name="line18"></a>goog.require(&#39;goog.dom.TagName&#39;);
<a name="line19"></a>goog.require(&#39;goog.editor.Command&#39;);
<a name="line20"></a>goog.require(&#39;goog.editor.plugins.AbstractBubblePlugin&#39;);
<a name="line21"></a>goog.require(&#39;goog.string.Unicode&#39;);
<a name="line22"></a>goog.require(&#39;goog.ui.editor.Bubble&#39;);
<a name="line23"></a>goog.require(&#39;goog.ui.equation.ImageRenderer&#39;);
<a name="line24"></a>
<a name="line25"></a>
<a name="line26"></a>
<a name="line27"></a>/**
<a name="line28"></a> * Property bubble plugin for equations.
<a name="line29"></a> *
<a name="line30"></a> * @constructor
<a name="line31"></a> * @extends {goog.editor.plugins.AbstractBubblePlugin}
<a name="line32"></a> * @final
<a name="line33"></a> */
<a name="line34"></a>goog.editor.plugins.equation.EquationBubble = function() {
<a name="line35"></a>  goog.editor.plugins.equation.EquationBubble.base(this, &#39;constructor&#39;);
<a name="line36"></a>};
<a name="line37"></a>goog.inherits(goog.editor.plugins.equation.EquationBubble,
<a name="line38"></a>    goog.editor.plugins.AbstractBubblePlugin);
<a name="line39"></a>
<a name="line40"></a>
<a name="line41"></a>/**
<a name="line42"></a> * Id for &#39;edit&#39; link.
<a name="line43"></a> * @type {string}
<a name="line44"></a> * @private
<a name="line45"></a> */
<a name="line46"></a>goog.editor.plugins.equation.EquationBubble.EDIT_ID_ = &#39;ee_bubble_edit&#39;;
<a name="line47"></a>
<a name="line48"></a>
<a name="line49"></a>/**
<a name="line50"></a> * Id for &#39;remove&#39; link.
<a name="line51"></a> * @type {string}
<a name="line52"></a> * @private
<a name="line53"></a> */
<a name="line54"></a>goog.editor.plugins.equation.EquationBubble.REMOVE_ID_ = &#39;ee_remove_remove&#39;;
<a name="line55"></a>
<a name="line56"></a>
<a name="line57"></a>/**
<a name="line58"></a> * @desc Label for the equation property bubble.
<a name="line59"></a> */
<a name="line60"></a>var MSG_EE_BUBBLE_EQUATION = goog.getMsg(&#39;Equation:&#39;);
<a name="line61"></a>
<a name="line62"></a>
<a name="line63"></a>/**
<a name="line64"></a> * @desc Link text for equation property bubble to edit the equation.
<a name="line65"></a> */
<a name="line66"></a>var MSG_EE_BUBBLE_EDIT = goog.getMsg(&#39;Edit&#39;);
<a name="line67"></a>
<a name="line68"></a>
<a name="line69"></a>/**
<a name="line70"></a> * @desc Link text for equation property bubble to remove the equation.
<a name="line71"></a> */
<a name="line72"></a>var MSG_EE_BUBBLE_REMOVE = goog.getMsg(&#39;Remove&#39;);
<a name="line73"></a>
<a name="line74"></a>
<a name="line75"></a>/** @override */
<a name="line76"></a>goog.editor.plugins.equation.EquationBubble.prototype.getTrogClassId =
<a name="line77"></a>    function() {
<a name="line78"></a>  return &#39;EquationBubble&#39;;
<a name="line79"></a>};
<a name="line80"></a>
<a name="line81"></a>
<a name="line82"></a>/** @override */
<a name="line83"></a>goog.editor.plugins.equation.EquationBubble.prototype.
<a name="line84"></a>    getBubbleTargetFromSelection = function(selectedElement) {
<a name="line85"></a>  if (selectedElement &amp;&amp;
<a name="line86"></a>      goog.ui.equation.ImageRenderer.isEquationElement(selectedElement)) {
<a name="line87"></a>    return selectedElement;
<a name="line88"></a>  }
<a name="line89"></a>  return null;
<a name="line90"></a>};
<a name="line91"></a>
<a name="line92"></a>
<a name="line93"></a>/** @override */
<a name="line94"></a>goog.editor.plugins.equation.EquationBubble.prototype.createBubbleContents =
<a name="line95"></a>    function(bubbleContainer) {
<a name="line96"></a>  goog.dom.appendChild(bubbleContainer,
<a name="line97"></a>      bubbleContainer.ownerDocument.createTextNode(
<a name="line98"></a>      MSG_EE_BUBBLE_EQUATION + goog.string.Unicode.NBSP));
<a name="line99"></a>
<a name="line100"></a>  this.createLink(goog.editor.plugins.equation.EquationBubble.EDIT_ID_,
<a name="line101"></a>      MSG_EE_BUBBLE_EDIT, this.editEquation_, bubbleContainer);
<a name="line102"></a>
<a name="line103"></a>  goog.dom.appendChild(bubbleContainer,
<a name="line104"></a>      bubbleContainer.ownerDocument.createTextNode(
<a name="line105"></a>      MSG_EE_BUBBLE_EQUATION +
<a name="line106"></a>      goog.editor.plugins.AbstractBubblePlugin.DASH_NBSP_STRING));
<a name="line107"></a>
<a name="line108"></a>  this.createLink(goog.editor.plugins.equation.EquationBubble.REMOVE_ID_,
<a name="line109"></a>      MSG_EE_BUBBLE_REMOVE, this.removeEquation_, bubbleContainer);
<a name="line110"></a>};
<a name="line111"></a>
<a name="line112"></a>
<a name="line113"></a>/** @override */
<a name="line114"></a>goog.editor.plugins.equation.EquationBubble.prototype.getBubbleType =
<a name="line115"></a>    function() {
<a name="line116"></a>  return goog.dom.TagName.IMG;
<a name="line117"></a>};
<a name="line118"></a>
<a name="line119"></a>
<a name="line120"></a>/** @override */
<a name="line121"></a>goog.editor.plugins.equation.EquationBubble.prototype.getBubbleTitle =
<a name="line122"></a>    function() {
<a name="line123"></a>  /** @desc Title for the equation bubble. */
<a name="line124"></a>  var MSG_EQUATION_BUBBLE_TITLE = goog.getMsg(&#39;Equation&#39;);
<a name="line125"></a>  return MSG_EQUATION_BUBBLE_TITLE;
<a name="line126"></a>};
<a name="line127"></a>
<a name="line128"></a>
<a name="line129"></a>/**
<a name="line130"></a> * Removes the equation associated with the bubble.
<a name="line131"></a> * @private
<a name="line132"></a> */
<a name="line133"></a>goog.editor.plugins.equation.EquationBubble.prototype.removeEquation_ =
<a name="line134"></a>    function() {
<a name="line135"></a>  this.getFieldObject().dispatchBeforeChange();
<a name="line136"></a>
<a name="line137"></a>  goog.dom.removeNode(this.getTargetElement());
<a name="line138"></a>
<a name="line139"></a>  this.closeBubble();
<a name="line140"></a>
<a name="line141"></a>  this.getFieldObject().dispatchChange();
<a name="line142"></a>};
<a name="line143"></a>
<a name="line144"></a>
<a name="line145"></a>/**
<a name="line146"></a> * Opens equation editor for the equation associated with the bubble.
<a name="line147"></a> * @private
<a name="line148"></a> */
<a name="line149"></a>goog.editor.plugins.equation.EquationBubble.prototype.editEquation_ =
<a name="line150"></a>    function() {
<a name="line151"></a>  var equationNode = this.getTargetElement();
<a name="line152"></a>  this.closeBubble();
<a name="line153"></a>  this.getFieldObject().execCommand(goog.editor.Command.EQUATION, equationNode);
<a name="line154"></a>};
</pre>


</body>
</html>
